package com.chixing.service;

import com.chixing.entity.DTO.OrderCancelEarlyDTO;
import com.chixing.entity.DTO.OrderCreateDTO;
import com.chixing.entity.Orders;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chixing.utils.Result;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author smith
 * @since 2025-09-30
 */
public interface IOrdersService {
    //通过订单id查询订单详细信息
    public Result getOrderDetail(Long orderId);
    public Result updateStatus(Long orderId, String orderStatus);

    public Result getById(Long orderId);

    public Result getByOrderNumber(String orderNum);

    //------------------------
    //通过订单状态分页查询订单
    public Result getByPageAndStatus(Integer userId, String orderStatus, Integer pageNum); //分页查询
    public Result getOrderDetails(Long orderId); //订单详情查询
    public Result getByOrderId(Long orderId);
    public Result createOrder(OrderCreateDTO orderCreateDTO);

    /**
     * 取消待支付订单（释放库存锁）
     * @param orderId 订单ID
     * @param userId 用户ID（防越权）
     * @return 取消结果
     */
    public Result cancelUnpaidOrder(Long orderId,Integer userId);

    //已支付订单的提前取消
    public Result orderCancelEarly(Long orderId);

}
